$('#fabuZhaopinPage').load(function () {
    $('input[name=name]').val(RssUser.Data.nickname);
    $('.fabu-zp-btn').click(function () {
        RssApi.Table.Append('zhaopin').setLoading().keyvalue($('#zp-form').serializeArray()).keymyid().keyvalue('typeid', 1).getJson(function (data) {
            if(data.id) {
                alert('发布成功');
                window.location.href='index.html';
            } else {
                alert('发布失败');
            }
        })
    })
})
$('#fabuQiuzhiPage').load(function () {
    $('input[name=name]').val(RssUser.Data.nickname);
    $('.fabu-zp-btn').click(function () {
        RssApi.Table.Append('zhaopin').setLoading().keyvalue($('#zp-form').serializeArray()).keymyid().keyvalue('typeid', 2).getJson(function (data) {
            if(data.id) {
                alert('发布成功');
                window.location.href='index.html';
            } else {
                alert('发布失败');
            }
        })
    })
})
$('#zhaopinPage').load(function () {
    getZPList()
})
$('#qiuzhiPage').load(function () {
    getQZList()
})
$('#zhaopinStatusPage').load(function(){
   RssApi.Table.List('zhaopin').keyvalue("typeid", 1).condition({myid: RssUser.Data.myid, typeid: 1}).getJson(function (data) {
        $.each(data, function (idx, rows) {
            rows['classifyid'] = getClassfiyid(rows.classifyid);
            rows['shijian'] = formatTest(rows.shijian);
            rows['title'] = rows['classifyid']+rows.money;
             rows['namess'] = rows.name;
        })
        $('.wrap-my-zp-content').maplist(data);
    })
})
function toQZ() {
    window.location.hash = '#qiuzhiPage';
}
function toZP() {
    window.location.hash = '#zhaopinPage';
}
function getZPList() {
    const dict = { money: $('input[name=money]').val(), hangye: $('input[name=hangyess]').val(), gangwei: $('input[name=gangwei]').val(), typeid: 1};
    if ($('input[name=hangyess]').val().length === 0) {
        delete dict.hangye;
    }
    if ($('input[name=money]').val().length === 0) {
        delete dict.money;
    }
    if ($('input[name=gangwei]').val().length === 0) {
        delete dict.gangwei;
    }
    RssApi.Table.List('zhaopin').keyvalue("typeid", 1).condition(dict).getJson(function (data) {
        $.each(data, function (idx, rows) {
            rows['classifyid'] = getClassfiyid(rows.classifyid);
            rows['shijian'] = formatTest(rows.shijian);
            rows['title'] = rows['classifyid']+rows.money;
             rows['namess'] = rows.name;
        })
        $('.wrap-zhaopin-list').maplist(data);
    })
}
function getQZList() {
    const dict = { money: $('input[name=money]').val(), hangye: $('input[name=hangye]').val(), gangwei: $('input[name=gangwei]').val(), typeid: 2};
    if ($('input[name=hangye]').val().length === 0) {
        delete dict.hangye;
    }
    if ($('input[name=money]').val().length === 0) {
        delete dict.money;
    }
    if ($('input[name=gangwei]').val().length === 0) {
        delete dict.gangwei;
    }
    RssApi.Table.List('zhaopin').keyvalue("typeid", 2).condition(dict).getJson(function (data) {
        $.each(data, function (idx, rows) {
            rows['classifyid'] = getClassfiyid(rows.classifyid);
            rows['shijian'] = formatTest(rows.shijian);
            rows['title'] = rows['classifyid']+rows.money;
             rows['namess'] = rows.name;
        })
        $('.wrap-zhaopin-list').maplist(data);
    })
}
